﻿<%@ Assembly Name="$SharePoint.Project.AssemblyFullName$" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register TagPrefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="asp" Namespace="System.Web.UI" Assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Assembly Name="Microsoft.Web.CommandUI, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="VerifyContentItems.aspx.cs" Inherits="SlamCms.SharePoint.UtilityPages.VerifyContentItems" DynamicMasterPageFile="~masterurl/default.master" %>

<asp:content id="PageHead" contentplaceholderid="PlaceHolderAdditionalPageHead" runat="server">
</asp:content>

<asp:content id="Main" contentplaceholderid="PlaceHolderMain" runat="server">
	<div ID="buttons" runat="server">
        <asp:Button ID="btnVerifyPrevious" runat="server" Text="Verify Only - See Previous Result"/>
		<asp:Button ID="btnVerify" runat="server" Text="Verify Only"/>
		<asp:Button ID="btnVerifyAndSync" runat="server" Text="Verify and Sync" />
	</div>
	<br />
	<div ID="reports"  runat="server" visible="false">
		<div>
			<a href="#notfound">Items not found in ContentItem</a><br />
			<a href="#mismatchinglistrelativeids">Items with mismatching ListRelatIveIDs</a><br />
			<a href="#mismatchinglistids">Items with mismatching ListIDs and potentially duplicate SLAM IDs</a><br />
			<a href="#duplicateslamids">Items with duplicated SLAM IDs</a><br />
			<a href="#mismatchingstatuses">Items with mismatching Statuses</a><br />
			<a href="#notfoundsharepoint">Items not found in SharePoint</a>
		</div>
		<div>
			<a name="notfound"></a>
			<asp:Literal ID="ltNotFoundContentItem" runat="server"></asp:Literal>Items not found in ContentItem
			<asp:GridView ID="gridContentItemNotFound" runat="server" AutoGenerateColumns="false">
				<Columns>
					<asp:BoundField HeaderText="Content Item ID" DataField="ContentItemID" />
					<asp:BoundField HeaderText="Title" DataField="Title"/>
                    <asp:BoundField HeaderText="Status" DataField="Status"/>
					<asp:HyperLinkField HeaderText="Edit Link" DataNavigateUrlFields="EditLink" DataNavigateUrlFormatString="{0}" DataTextField="EditLink" Target="_blank" ItemStyle-Width="60%" />
					<asp:TemplateField>
						<ItemTemplate>
							<asp:LinkButton ID="fixMissingContentItemButton" runat="server" CausesValidation="false" Text="Fix" CommandArgument='<%# Eval("EditLink") %>' OnCommand="fixMissingContentItemButton_Command" />
						</ItemTemplate>
					</asp:TemplateField>
				</Columns>
			</asp:GridView>
		</div>
		<br />
		<div>
			<a name="mismatchinglistrelativeids"></a>
			<asp:Literal ID="ltListRelativeID" runat="server"></asp:Literal>Items with mismatching ListRelatIveIDs
			<asp:GridView ID="gridListRelativeID" runat="server" AutoGenerateColumns="false" Visible="false">
				<Columns>
					<asp:BoundField HeaderText="Content Item ID" DataField="ContentItemID"/>
					<asp:BoundField HeaderText="Title" DataField="Title"/>
                    <asp:BoundField HeaderText="Status" DataField="Status"/>
					<asp:HyperLinkField HeaderText="Edit Link" DataNavigateUrlFields="EditLink" DataNavigateUrlFormatString="{0}" DataTextField="EditLink" Target="_blank" ItemStyle-Width="60%" />
					<asp:TemplateField>
						<ItemTemplate>
							<asp:LinkButton ID="fixMismatchListRelativeIdButton" runat="server" CausesValidation="false" Text="Fix" CommandArgument='<%# Eval("EditLink") %>' OnCommand="fixMismatchListRelativeIdButton_Command" />
						</ItemTemplate>
					</asp:TemplateField>
				</Columns>
			</asp:GridView>
			<asp:GridView ID="gridListRelativeIDUpdated" runat="server" AutoGenerateColumns="false" Visible="false">
				<Columns>
					<asp:BoundField HeaderText="Content Item ID" DataField="ContentItemID" />
					<asp:BoundField HeaderText="Title" DataField="Title" />
                    <asp:BoundField HeaderText="Status" DataField="Status"/>
					<asp:BoundField HeaderText="Edit Link" DataField="EditLink" />
					<asp:HyperLinkField HeaderText="New Edit Link" DataNavigateUrlFields="NewEditLink" DataNavigateUrlFormatString="{0}" DataTextField="NewEditLink" Target="_blank" ItemStyle-Width="60%" />
				</Columns>
			</asp:GridView>
		</div>
		<br />
		<div>
			<a name="mismatchinglistids"></a>
			Items with mismatching ListIDs and potentially duplicate SLAM IDs
			<asp:GridView ID="gridListID" runat="server" AutoGenerateColumns="false">
				<Columns>
					<asp:BoundField HeaderText="Content Item ID" DataField="ContentItemID" />
					<asp:BoundField HeaderText="Title" DataField="Title" />
                    <asp:BoundField HeaderText="Status" DataField="Status"/>
					<asp:HyperLinkField HeaderText="Edit Link" DataNavigateUrlFields="EditLink" DataNavigateUrlFormatString="{0}" DataTextField="EditLink" Target="_blank" ItemStyle-Width="60%" />
				</Columns>
			</asp:GridView>
		</div>
		<br />
		<div>
			<a name="duplicateslamids"></a>
			Items with duplicated SLAM IDs
			<asp:GridView ID="gridDuplicateSlamIds" runat="server" AutoGenerateColumns="false">
				<Columns>
					<asp:BoundField HeaderText="Content Item ID" DataField="ContentItemID" />
					<asp:BoundField HeaderText="Title" DataField="Title"/>
                    <asp:BoundField HeaderText="Status" DataField="Status"/>
					<asp:BoundField HeaderText="SharePoint Status" DataField="SharePointStatus"/>
					<asp:HyperLinkField HeaderText="Edit Link" DataNavigateUrlFields="EditLink" DataNavigateUrlFormatString="{0}" DataTextField="EditLink" Target="_blank" ItemStyle-Width="60%" />
					<asp:TemplateField ItemStyle-Width="10%">
						<ItemTemplate>
							<asp:LinkButton ID="assignNewSlamIdButton" runat="server" CausesValidation="false" Text="Assign New ID" CommandArgument='<%# Eval("EditLink") %>' OnCommand="assignNewSlamIdButton_Command" />
						</ItemTemplate>
					</asp:TemplateField>
				</Columns>
			</asp:GridView>
		</div>
		<br />
		<div>
			<a name="mismatchingstatuses"></a>
			Items with mismatching Statuses
			<asp:GridView ID="gridMismatchingStatuses" runat="server" AutoGenerateColumns="false">
				<Columns>
					<asp:BoundField HeaderText="Content Item ID" DataField="ContentItemID" />
					<asp:BoundField HeaderText="Title" DataField="Title"/>
					<asp:BoundField HeaderText="Status" DataField="Status"/>
                    <asp:BoundField HeaderText="SharePoint Status" DataField="SharePointStatus"/>
					<asp:HyperLinkField HeaderText="Edit Link" DataNavigateUrlFields="EditLink" DataNavigateUrlFormatString="{0}" DataTextField="EditLink" Target="_blank" ItemStyle-Width="60%" />
					<asp:TemplateField>
						<ItemTemplate>
							<asp:LinkButton ID="fixMismatchedStatusButton" runat="server" CausesValidation="false" Text="Fix" CommandArgument='<%# Eval("EditLink") %>' OnCommand="fixMismatchedStatusButton_Command" />
						</ItemTemplate>
					</asp:TemplateField>
				</Columns>
			</asp:GridView>
		</div>
		<br />
		<div>
			<a name="notfoundsharepoint"></a>
			<asp:Literal ID="ltSharePointNotFound" runat="server"></asp:Literal>Items not found in SharePoint
			<asp:GridView ID="gridSharePointNotFound" runat="server" AutoGenerateColumns="false">
				<Columns>
					<asp:BoundField HeaderText="Content Item ID" DataField="ContentItemID" />
					<asp:BoundField HeaderText="Title" DataField="Title" />
                    <asp:BoundField HeaderText="Status" DataField="Status"/>
					<asp:BoundField HeaderText="Edit Link" DataField="EditLink" ItemStyle-Width="60%" />
					<asp:TemplateField>
						<ItemTemplate>
							<asp:LinkButton ID="fixMissingSharePointItemButton" runat="server" CausesValidation="false" Text="Fix" CommandArgument='<%# Eval("ContentItemID") %>' OnCommand="fixMissingSharePointItemButton_Command" />
						</ItemTemplate>
					</asp:TemplateField>
				</Columns>
			</asp:GridView>
		</div>
	</div>
</asp:content>
<asp:content id="PageTitle" contentplaceholderid="PlaceHolderPageTitle" runat="server">
Verify ContentItems
</asp:content>
<asp:content id="PageTitleInTitleArea" contentplaceholderid="PlaceHolderPageTitleInTitleArea" runat="server">
Verify ContentItems
</asp:content>
